package com.tengju.user.application.user.dto;

import com.tengju.data.domain.model.user.DominationLevelEnum;
import com.tengju.user.application.archives.dto.PageQueryDTO;
import com.tengju.user.domain.annotation.ElasticCryptEntity;
import com.tengju.user.domain.model.club.ClubId;
import com.tengju.user.domain.model.sign.StarSignStatus;
import com.tengju.user.domain.model.user.StarLevelEnum;
import com.tengju.user.domain.model.user.UserId;
import com.tengju.user.domain.model.user.UserIdCode;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@ElasticCryptEntity(cryptFields = {"name","mobile"})
public class UserSearchForm extends PageQueryDTO {

    private UserIdCode idCode;

    private List<UserIdCode> idCodes;

    private UserId tjUserId;

    private UserId abmUserId;

    private String mobile;

    private String nickname;

    private UserIdCode pidCode;
    private UserIdCode dominationTeamPidCode;
    private Long monthNewStartTime;
    private Long monthNewEndTime;
    private String sentimentContext;

    private StarLevelEnum starLevel;

    private List<StarSignStatus> signStatusList;

    private StarLevelEnum signTargetStarLevel;

    private StarLevelEnum targetStarLevel;

    private List<ClubId> clubIds;

    /**
     * 手机号 or 昵称 or 备注
     */
    private String keyWords;

    private Long ownerEcIdCode;

    private Long ownerGenSecIdCode;

    private List<Long> ownerGenSecIdCodes;

    private Long ownerCityIdCode;

    private String operator;
    private String scrollId;

    private Long leaderId;

    private String serviceProviderIdAndNicknameAndMobile;

    public void belongOwner(DominationLevelEnum dominationLevel, UserIdCode idCode) {
        switch (dominationLevel) {
            case GEN_SEC:
                this.ownerGenSecIdCode = idCode.getValue();
                this.leaderId = idCode.getValue();
                break;
            case EC:
                this.ownerEcIdCode = idCode.getValue();
                this.leaderId = idCode.getValue();
                break;
            case GEN_CITY_STAR:
                this.ownerCityIdCode = idCode.getValue();
                this.leaderId = idCode.getValue();
                break;
            default:
                return;
        }
    }
}
